package pers.lx.crm.controller.info;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.lx.crm.base.common.pigeon.Result;
import pers.lx.crm.entiy.info.InfoListDO;
import pers.lx.crm.entiy.info.TagDO;
import pers.lx.crm.service.info.TagService;

import java.util.List;

/**
 * Created by lxl on 2017/2/15.
 */
@Controller
@RequestMapping(value = "tag")
public class TagController {

    @Autowired
    private TagService tagService ;

    @RequestMapping(value = "/list")
    public @ResponseBody
    Result getTagList(TagDO tagDO){
        return tagService.getTags(tagDO) ;
    }

    @RequestMapping(value = "/kind")
    public @ResponseBody
    Result getTagKind(){
        return tagService.getTagKinds() ;
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public @ResponseBody
    Result addTag(@RequestBody TagDO tagDO){
       Result result = tagService.addTag(tagDO) ;
        return result ;
    } ;

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public @ResponseBody
    Result updateTag(@RequestBody TagDO tagDO){
        Result result = tagService.updateTag(tagDO) ;
        return  result ;
    }

    @RequestMapping(value = "/remove",method = RequestMethod.POST)
    public @ResponseBody
    Result removeTags(@RequestBody InfoListDO listDO){
        Result result = tagService.removeTags(listDO.getTagDOList()) ;
        return  result ;
    }

}
